﻿using System;

namespace TypeBuilderFx.Core.Emitters
{
	/// <summary>Applies a validation level for reference type to properties.</summary>
	[AttributeUsage(AttributeTargets.Property, Inherited = true, AllowMultiple = false)]
	public class ReferenceTypeValidationAttribute : Attribute
	{
		private readonly ReferenceTypeValidationLevel _validationLevel;

		/// <summary>Construct the attribute with a validation level.</summary>
		/// <param name="validationLevel"></param>
		public ReferenceTypeValidationAttribute(ReferenceTypeValidationLevel validationLevel)
		{
			_validationLevel = validationLevel;
		}

		/// <summary>Returns the validation level applied on the property.</summary>
		public ReferenceTypeValidationLevel ValidationLevel
		{
			get { return _validationLevel; }
		}
	}
}